




*************************************
*************************************




use "data\data3_ind.dta", clear



******************* Table A21 panel A
******************* 


eststo clear

eststo R1: ivreg2 d_sh_empl_mfg (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R2: ivreg2 d_sh_empl_nmfg (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R3: ivreg2 d_sh_empl (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R4: ivreg2 d_sh_unempl (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R5: ivreg2 d_sh_nilf (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sic3) 

esttab R1 R2 R3 R4 R5 using "results\w3\tA21A.tex", replace se obs star(* 0.10 ** 0.05 *** 0.01) label nocons nogaps b(%9.3f) se(%9.3f)  ///
mtitle("" "" "" "" "" "")  



******************* Table A21 panel B
******************* 

eststo clear

eststo R1: ivreg2 d_sh_empl_mfg_edu_nc (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R2: ivreg2 d_sh_empl_nmfg_edu_nc (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R3: ivreg2 d_sh_empl_edu_nc (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R4: ivreg2 d_sh_unempl_edu_nc (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R5: ivreg2 d_sh_nilf_edu_nc (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sic3) 

esttab R1 R2 R3 R4 R5 using "results\w3\tA21B.tex", replace se obs star(* 0.10 ** 0.05 *** 0.01) label nocons nogaps b(%9.3f) se(%9.3f)  ///
mtitle("" "" "" "" "" "")  


******************* Table A21 panel C
******************* 

eststo clear

eststo R1: ivreg2 d_sh_empl_mfg_edu_c (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R2: ivreg2 d_sh_empl_nmfg_edu_c (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R3: ivreg2 d_sh_empl_edu_c (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R4: ivreg2 d_sh_unempl_edu_c (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R5: ivreg2 d_sh_nilf_edu_c (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sic3) 

esttab R1 R2 R3 R4 R5 using "results\w3\tA21C.tex", replace se obs star(* 0.10 ** 0.05 *** 0.01) label nocons nogaps b(%9.3f) se(%9.3f)  ///
mtitle("" "" "" "" "" "") 



******************* Table A22
******************* 

eststo clear

eststo R1: ivreg2 lnchg_popworkage (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sic3) 

eststo R2: ivreg2 lnchg_popworkage_edu_nc (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sic3) 

eststo R3: ivreg2 lnchg_popworkage_edu_c (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sic3)  

esttab R1 R2 R3 using "results\w3\tA22.tex", replace se obs star(* 0.10 ** 0.05 *** 0.01) label nocons nogaps b(%9.3f) se(%9.3f)  ///
mtitle("" "" "" "" "" "") 




******************* Table A23
******************* 


eststo clear
eststo R1: ivreg2 d_sh_empl_constr (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R2: ivreg2 d_sh_empl_trans_util (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R3: ivreg2 d_sh_empl_trade (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R4: ivreg2 d_sh_empl_other_serv (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R5: ivreg2 d_sh_empl_gov (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sic3) 

esttab R1 R2 R3 R4 R5 using "results\w3\tA23.tex", replace se obs star(* 0.10 ** 0.05 *** 0.01) label nocons nogaps b(%9.3f) se(%9.3f)  ///
mtitle("" "" "" "" "" "")  



   
******************* Table A24; panel A
******************* 


eststo clear
eststo R1: ivreg2 d_sh_empl_abstract_s1 (D_t_US_s1 D_t_MEX_s1 = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R2: ivreg2 d_sh_empl_abstract (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sic3) 

eststo R3: ivreg2 d_sh_empl_nc_abstract_s1 (D_t_US_s1 D_t_MEX_s1 = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R4: ivreg2 d_sh_empl_c_abstract_s1 (D_t_US_s1 D_t_MEX_s1 = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R5: ivreg2 d_sh_empl_mfg_abstract_s2 (D_t_US_s2 D_t_MEX_s2 = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R6: ivreg2 d_sh_empl_nmfg_abstract_s3 (D_t_US_s3 D_t_MEX_s3 = g_US g_MEX) [aw=s_n], cluster(sic3) 

esttab R1 R2 R3 R4 R5 R6 using "results\w3\tA24A.tex", replace se obs star(* 0.10 ** 0.05 *** 0.01) label nocons nogaps b(%9.3f) se(%9.3f)  ///
mtitle("" "" "" "" "" "" "")  



******************* Table A24; panel B 
******************* 


eststo clear
eststo R1: ivreg2 d_sh_empl_clerical_s1 (D_t_US_s1 D_t_MEX_s1 = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R2: ivreg2 d_sh_empl_clerical (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sic3) 

eststo R3: ivreg2 d_sh_empl_nc_clerical_s1 (D_t_US_s1 D_t_MEX_s1 = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R4: ivreg2 d_sh_empl_c_clerical_s1 (D_t_US_s1 D_t_MEX_s1 = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R5: ivreg2 d_sh_empl_mfg_clerical_s2 (D_t_US_s2 D_t_MEX_s2 = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R6: ivreg2 d_sh_empl_nmfg_clerical_s3 (D_t_US_s3 D_t_MEX_s3 = g_US g_MEX) [aw=s_n], cluster(sic3) 

esttab R1 R2 R3 R4 R5 R6 using "results\w3\tA24B.tex", replace se obs star(* 0.10 ** 0.05 *** 0.01) label nocons nogaps b(%9.3f) se(%9.3f)  ///
mtitle("" "" "" "" "" "" "") 



******************* Table A24; panel C 
******************* 


eststo clear
eststo R1: ivreg2 d_sh_empl_production_s1 (D_t_US_s1 D_t_MEX_s1 = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R2: ivreg2 d_sh_empl_production (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sic3) 

eststo R3: ivreg2 d_sh_empl_nc_production_s1 (D_t_US_s1 D_t_MEX_s1 = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R4: ivreg2 d_sh_empl_c_production_s1 (D_t_US_s1 D_t_MEX_s1 = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R5: ivreg2 d_sh_empl_mfg_production_s2 (D_t_US_s2 D_t_MEX_s2 = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R6: ivreg2 d_sh_empl_nmfg_production_s3 (D_t_US_s3 D_t_MEX_s3 = g_US g_MEX) [aw=s_n], cluster(sic3) 

esttab R1 R2 R3 R4 R5 R6 using "results\w3\tA24C.tex", replace se obs star(* 0.10 ** 0.05 *** 0.01) label nocons nogaps b(%9.3f) se(%9.3f)  ///
mtitle("" "" "" "" "" "" "") 



******************* Table A24; panel D  
******************* 


eststo clear
eststo R1: ivreg2 d_sh_empl_manual_s1 (D_t_US_s1 D_t_MEX_s1 = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R2: ivreg2 d_sh_empl_manual (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sic3) 

eststo R3: ivreg2 d_sh_empl_nc_manual_s1 (D_t_US_s1 D_t_MEX_s1 = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R4: ivreg2 d_sh_empl_c_manual_s1 (D_t_US_s1 D_t_MEX_s1 = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R5: ivreg2 d_sh_empl_mfg_manual_s2 (D_t_US_s2 D_t_MEX_s2 = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R6: ivreg2 d_sh_empl_nmfg_manual_s3 (D_t_US_s3 D_t_MEX_s3 = g_US g_MEX) [aw=s_n], cluster(sic3) 

esttab R1 R2 R3 R4 R5 R6 using "results\w3\tA24D.tex", replace se obs star(* 0.10 ** 0.05 *** 0.01) label nocons nogaps b(%9.3f) se(%9.3f)  ///
mtitle("" "" "" "" "" "" "") 


		  
		  
***********************
*********************** Table A25



use "data\data3_ind.dta", clear

** odd-numbered columns

eststo clear

eststo R1a: ivreg2 d_sh_empl_mfg (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R2a: ivreg2 d_sh_empl_nmfg (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R3a: ivreg2 d_sh_empl (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R4a: ivreg2 d_sh_unempl (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R5a: ivreg2 d_sh_nilf (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sic3) 



use "data\data5_ind.dta", clear

** even-numbered columns

eststo R1b: ivreg2 d_sh_empl_mfg1990_2007 (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R2b: ivreg2 d_sh_empl_nmfg1990_2007 (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R3b: ivreg2 d_sh_empl1990_2007 (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R4b: ivreg2 d_sh_unempl1990_2007 (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R5b: ivreg2 d_sh_nilf1990_2007 (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sic3) 


esttab R1a R1b R2a R2b R3a R3b R4a R4b R5a R5b using "results\w3\tA25.tex", replace se obs star(* 0.10 ** 0.05 *** 0.01) label nocons nogaps b(%9.3f) se(%9.3f)  ///
mtitle("" "" "" "" "" "" "" "" "" "")   keep(D_t_US D_t_MEX )



		  

******************* Table A26
******************* 

eststo clear

eststo R1: ivreg2 d_sh_empl_mfg (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sic3) 
eststo R2: ivreg2 d_sh_empl_mfg (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sic2) 
eststo R3: ivreg2 d_sh_empl_mfg (D_t_US D_t_MEX = g_US g_MEX) [aw=s_n], cluster(sicg) 

esttab R1 R2 R3 using "results\w3\tA26.tex", replace se obs star(* 0.10 ** 0.05 *** 0.01) label nocons nogaps b(%9.3f) se(%9.3f)  ///
mtitle("" "" "" "" "" "")  
		  
		  
		  
		  
		  
		  



******************* Table A29 
******************* 

use "data\data1_regional.dta", clear

eststo clear

eststo R1: ivregress 2sls d_sh_empl_mfg  D_t_US D_t_MEX (xCHN=xOTH) Lsh_manuf l_sh_popfborn l_sh_routine33 l_task_outsource i.div [aw=time] , cluster(statefip)



use "data\data3_ind.dta", clear

eststo R2: ivreg2 d_sh_empl_mfg_s4 (D_t_US_s4 D_t_MEX_s4 = g_US g_MEX) [aw=s_n], cluster(sic3) 


esttab R1 R2 using "results\w3\tA29.tex", replace se obs star(* 0.10 ** 0.05 *** 0.01) label nocons nogaps b(%9.3f) se(%9.3f)  ///
mtitle("" "" "" "" "" "")  keep(D_t_US D_t_MEX D_t_US_s4 D_t_MEX_s4)



		  
		  


******************* Table A30
******************* 		  

use "data\data1_regional.dta", clear
							 
eststo clear							 

eststo R1: ivregress 2sls d_sh_empl_mfg D_t_US D_t_MEX  (xCHN=xOTH) Lsh_manuf l_sh_popedu_c ///
                             l_sh_popfborn l_sh_empl_f l_sh_routine33 l_task_outsource i.div ///
							 D_IMP_WLD D_EMP_WLD D_t_US_MFN   ///
							  i.div ///
							 [aw=time] , cluster(statefip)
							 
							 
eststo R2: ivregress 2sls d_sh_empl_mfg D_t_US D_t_MEX  (xCHN=xOTH) Lsh_manuf l_sh_popedu_c ///
                             l_sh_popfborn l_sh_empl_f l_sh_routine33 l_task_outsource i.div  ///
							 d_sh_empl_mfg1970 d_sh_empl_mfg1980 ///
							 [aw=time] , cluster(statefip)

							 
eststo R3: ivregress 2sls d_sh_empl_mfg D_t_US D_t_MEX  (xCHN=xOTH) Lsh_manuf l_sh_popedu_c ///
                             l_sh_popfborn l_sh_empl_f l_sh_routine33 l_task_outsource i.div ///
							 D_IMP_WLD D_EMP_WLD D_t_US_MFN  ///
							 d_sh_empl_mfg1970 d_sh_empl_mfg1980 ///
							 Lsh_sicgroup_* ///
							 [aw=time] , cluster(statefip)
							 
				

use "data\data3_ind.dta", clear


eststo R4: ivreg2 d_sh_empl_mfg_s5 (D_t_US_s5 D_t_MEX_s5 = g_US g_MEX) [aw=s_n], cluster(sic3) 

eststo R5: ivreg2 d_sh_empl_mfg_s6 (D_t_US_s6 D_t_MEX_s6 = g_US g_MEX) [aw=s_n], cluster(sic3) 

eststo R6: ivreg2 d_sh_empl_mfg_s7 (D_t_US_s7 D_t_MEX_s7 = g_US g_MEX) [aw=s_n], cluster(sic3) 


esttab R1 R2 R3 R4 R5 R6 using "results\w3\tA30.tex", replace se obs star(* 0.10 ** 0.05 *** 0.01) label nocons nogaps b(%9.3f) se(%9.3f)  ///
mtitle("" "" "" "" "" "" "" "")  keep(D_t_US D_t_MEX D_t_US_s5 D_t_US_s6 D_t_US_s7 D_t_MEX_s5 D_t_MEX_s6 D_t_MEX_s7)
		  
		  


****************************** Table A31 
****************************** 

use "data\data1_regional.dta", clear

eststo clear
eststo R1: ivregress 2sls d_sh_empl_mfg D_t_US D_t_MEX           (xCHN=xOTH) Lsh_manuf l_sh_popedu_c l_sh_popfborn l_sh_empl_f l_sh_routine33 l_task_outsource i.div [aw=time] , cluster(statefip)

eststo R2: ivregress 2sls d_sh_empl_mfg        D_t_MEX t_US_1990 (xCHN=xOTH) Lsh_manuf l_sh_popedu_c l_sh_popfborn l_sh_empl_f l_sh_routine33 l_task_outsource i.div [aw=time] , cluster(statefip)

eststo R3: ivregress 2sls d_sh_empl_mfg D_t_US D_t_MEX t_US_1990 (xCHN=xOTH) Lsh_manuf l_sh_popedu_c l_sh_popfborn l_sh_empl_f l_sh_routine33 l_task_outsource i.div [aw=time] , cluster(statefip)

esttab R1 R2 R3 using "results\w3\tA31.tex", replace se obs star(* 0.10 ** 0.05 *** 0.01) label nocons nogaps b(%9.3f) se(%9.3f)  ///
mtitle("" "" "" "" "" "")  keep(D_t_US t_US_1990) 
		  
		  
		  
		  


********************* Table A34
********************* 

use "data\data1_regional.dta", clear

eststo clear

eststo R1: ivregress 2sls d_sh_empl_mfg_f  D_t_US D_t_MEX (xCHN=xOTH) Lsh_manuf l_sh_popedu_c l_sh_popfborn l_sh_empl_f l_sh_routine33 l_task_outsource i.div [aw=time] , cluster(statefip)

eststo R2: ivregress 2sls d_sh_empl_mfg_f  D_t_US_F D_t_US_M D_t_MEX (xCHN=xOTH) Lsh_manuf l_sh_popedu_c l_sh_popfborn l_sh_empl_f l_sh_routine33 l_task_outsource i.div [aw=time] , cluster(statefip)


eststo R3: ivregress 2sls d_sh_empl_mfg_m  D_t_US D_t_MEX  (xCHN=xOTH) Lsh_manuf l_sh_popedu_c l_sh_popfborn l_sh_empl_f l_sh_routine33 l_task_outsource i.div [aw=time] , cluster(statefip)

eststo R4: ivregress 2sls d_sh_empl_mfg_m  D_t_US_F D_t_US_M D_t_MEX (xCHN=xOTH) Lsh_manuf l_sh_popedu_c l_sh_popfborn l_sh_empl_f l_sh_routine33 l_task_outsource i.div [aw=time] , cluster(statefip)


esttab R1 R2 R3 R4 using "results\w3\tA34.tex", replace se obs star(* 0.10 ** 0.05 *** 0.01) label nocons nogaps b(%9.3f) se(%9.3f)  ///
mtitle("" "" "" "" "" "")  keep(D_t_US D_t_MEX D_t_US_F D_t_US_M) 
		  
		 
		 
		 
		 
		 
		 
********************* Table A27, first column
********************* 
		 
use "data\data3_ind.dta", clear

gsort -sic3
gen table1_var="."
replace table1_var="mean" in 1
replace table1_var="s.d." in 2
replace table1_var="IQR"  in 3
replace table1_var="1/HHI"  in 4
replace table1_var="1/HHI_sic3"  in 5
replace table1_var="Largest_emp_share"  in 6
replace table1_var="Largest_emp_share_sic3"  in 7
replace table1_var="# shocks" in 8
replace table1_var="# industries" in 9
replace table1_var="# SIC3 groups" in 10

gen Col1=.

count if sic87dd!=0
	replace Col1 = r(N) in 8
distinct sic87dd if sic87dd!=0
	replace Col1 = r(ndistinct) in 9
distinct sic3 if sic87dd!=0
	replace Col1 = r(ndistinct) in 10

	
**********	
**********
	
drop if sic87dd==0
gsort -sic3

* create relevant employment shares, across all observations by periods
egen share_Col1=pc(s_n), prop

sum g_US [aw=share_Col1], d
	replace Col1 = r(mean) in 1
	replace Col1 = r(sd) in 2
	replace Col1 = r(p75)-r(p25) in 3

egen temp = sum(share_Col1^2)
replace Col1 = 1/temp in 4
drop temp

bysort sic3: egen sic3_share_Col1=sum(share_Col1)
sort sic3 sic87dd
by sic3: replace sic3_share_Col1=0 if _n>1
gsort -sic3
egen temp = sum(sic3_share_Col1^2)
replace Col1 = 1/temp in 5
drop temp 

sum share_Col1
	replace Col1 = r(max) in 6

	sum sic3_share_Col1
	replace Col1 = r(max)  in 7

keep table1 Col*
drop if table1=="."
format Col* %8.3f

keep table1_var Col1

gen b1 = "&"
gen b2 = "\\"

order table1_var b1 Col1 b2
keep table1_var  b1 Col1 b2






********************** Table A27, second column
********************** 

use "data\data3_ind.dta", clear

gsort -sic3
gen table1_var="."
replace table1_var="mean" in 1
replace table1_var="s.d." in 2
replace table1_var="IQR"  in 3
replace table1_var="1/HHI"  in 4
replace table1_var="1/HHI_sic3"  in 5
replace table1_var="Largest_emp_share"  in 6
replace table1_var="Largest_emp_share_sic3"  in 7
replace table1_var="# shocks" in 8
replace table1_var="# industries" in 9
replace table1_var="# SIC3 groups" in 10

gen Col1=.

	
* drop services
count if sic87dd!=0
	replace Col1 = r(N) in 8
distinct sic87dd if sic87dd!=0
	replace Col1 = r(ndistinct) in 9
distinct sic3 if sic87dd!=0
	replace Col1 = r(ndistinct) in 10

********
********	

drop if sic87dd==0
gsort -sic3

* create relevant employment shares, across all observations by periods
egen share_Col1=pc(s_n), prop

sum g_MEX [aw=share_Col1], d
	replace Col1 = r(mean) in 1
	replace Col1 = r(sd) in 2
	replace Col1 = r(p75)-r(p25) in 3

egen temp = sum(share_Col1^2)
replace Col1 = 1/temp in 4
drop temp

bysort sic3: egen sic3_share_Col1=sum(share_Col1)
sort sic3 sic87dd
by sic3: replace sic3_share_Col1=0 if _n>1
gsort -sic3
egen temp = sum(sic3_share_Col1^2)
replace Col1 = 1/temp in 5
drop temp 

sum share_Col1
	replace Col1 = r(max) in 6

	sum sic3_share_Col1
	replace Col1 = r(max)  in 7

keep table1 Col*
drop if table1=="."
format Col* %8.3f

keep table1_var Col1 

gen b1 = "&"
gen b2 = "&"

order table1_var b1 Col1 b2 
keep table1_var b1 Col1 b2 




************************ Table A28, column 1
************************  


use "data\data6a_balance.dta", clear


local balancevars l_sh_popedu_c l_sh_popfborn l_sh_empl_f l_sh_routine33 l_task_outsource d_sh_empl_mfg1970 d_sh_empl_mfg1980

eststo clear
local i = 1
foreach v of local balancevars {
	eststo R`i': ivreg2 `v' (z=g) year [aw=s_n], cluster(sic3)
local i = `i' + 1
}


esttab R1 R2 R3 R4 R5 R6 R7 using "results\w3\tA28col1.tex", replace se obs star(* 0.10 ** 0.05 *** 0.01) label nocons nogaps b(%9.3f) se(%9.3f)  ///
mtitle("" "" "" "" "" "" "")  




************************ Table A28, column 2
************************  


use "data\data6b_balance.dta", clear


local balancevars l_sh_popedu_c l_sh_popfborn l_sh_empl_f l_sh_routine33 l_task_outsource d_sh_empl_mfg1970 d_sh_empl_mfg1980

eststo clear
local i = 1
foreach v of local balancevars {
	eststo R`i': ivreg2 `v' (z=g) year [aw=s_n], cluster(sic3)
local i = `i' + 1
}


esttab R1 R2 R3 R4 R5 R6 R7 using "results\w3\tA28col2.tex", replace se obs star(* 0.10 ** 0.05 *** 0.01) label nocons nogaps b(%9.3f) se(%9.3f)  ///
mtitle("" "" "" "" "" "" "")  



************************ Table A28, column 3 
************************  

use "data\data6c_balance.dta", clear


local balancevars l_sh_popedu_c l_sh_popfborn l_sh_empl_f l_sh_routine33 l_task_outsource d_sh_empl_mfg1970 d_sh_empl_mfg1980

eststo clear
local i = 1
foreach v of local balancevars {
	eststo R`i': ivreg2 `v' (zMEX=gMEX) year [aw=s_n], cluster(sic3)
local i = `i' + 1
}


esttab R1 R2 R3 R4 R5 R6 R7 using "results\w3\tA28col3.tex", replace se obs star(* 0.10 ** 0.05 *** 0.01) label nocons nogaps b(%9.3f) se(%9.3f)  ///
mtitle("" "" "" "" "" "" "")  



************************ Table A28, column 4 
************************  


use "data\data6d_balance.dta", clear


local balancevars l_sh_popedu_c l_sh_popfborn l_sh_empl_f l_sh_routine33 l_task_outsource d_sh_empl_mfg1970 d_sh_empl_mfg1980

eststo clear
local i = 1
foreach v of local balancevars {
	eststo R`i': ivreg2 `v' (zMEX=gMEX) year [aw=s_n], cluster(sic3)
local i = `i' + 1
}


esttab R1 R2 R3 R4 R5 R6 R7 using "results\w3\tA28col4.tex", replace se obs star(* 0.10 ** 0.05 *** 0.01) label nocons nogaps b(%9.3f) se(%9.3f)  ///
mtitle("" "" "" "" "" "" "")  






***********************
*********************** Table A32


use "data\data1_regional.dta", clear

eststo clear


*mftg emp
eststo R1: ivregress 2sls d_sh_empl_mfg  D_t_US Lsh_manuf l_sh_popedu_c l_sh_popfborn l_sh_empl_f l_sh_routine33 l_task_outsource i.div [aw=time] , cluster(statefip)

*total emp
eststo R2: ivregress 2sls d_sh_empl  D_t_US Lsh_manuf l_sh_popedu_c l_sh_popfborn l_sh_empl_f l_sh_routine33 l_task_outsource i.div [aw=time] , cluster(statefip)



use "data\data4_regional_puma.dta", clear

* mftg emp
eststo R3: reg d_sh_empl_mfg D_t_US  sh_emp_mfg sh_college_pop sh_female_emp_pop sh_foreign_pop sh_emp_routine offshore_index_r i.reg [aw=pop_r], cluster(statefip)

* total emp
eststo R4: reg d_sh_empl D_t_US  sh_emp_mfg sh_college_pop sh_female_emp_pop sh_foreign_pop sh_emp_routine offshore_index_r i.reg [aw=pop_r], cluster(statefip)


esttab R1 R2 R3 R4 using "results\w3\tA32.tex", replace se obs star(* 0.10 ** 0.05 *** 0.01) label nocons nogaps b(%9.3f) se(%9.3f)  ///
mtitle("" "" "" "" "" "")  keep(D_t_US) 

